<template>
  <div class="cs-btn-toolbar">
    <el-button
      type="primary"
      size="mini"
      v-for="item in btnList"
      :key="item.eventName"
      @click="handleClick(item.eventName)">
      {{ item.text }}
    </el-button>
  </div>
</template>

<script type="text/ecmascript-6">
  export default {
    name: 'cs-btn-toolbar',
    props: {
      btnList: {
        type: Array,
        default: () => {
          return [
            {
              text: '新增',
              eventName: 'add'
            },
            {
              text: '删除',
              eventName: 'remove'
            }
          ]
        }
      }
    },
    methods: {
      handleClick (str) {
        this.$emit(str)
      }
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus">
  .cs-btn-toolbar
    height 50px
    line-height 50px
    background #fff
    padding 0 15px
</style>
